// pages/user-nav/user-nav.js
Page({
    data: {
      currentUser: {}, // 当前登录用户
    },
  
    onLoad() {
      const currentUser = wx.getStorageSync('currentUser');
      if (currentUser) {
        this.setData({ currentUser });
      } else {
        wx.showToast({
          title: '未登录，请先登录',
          icon: 'none',
          duration: 1500,
        });
  
        setTimeout(() => {
          wx.reLaunch({
            url: '/pages/login/login',
          });
        }, 1500);
      }
    },
  
    navigateToBorrow() {
      wx.navigateTo({
        url: '/pages/borrow/borrow',
      });
    },
  
    navigateToInventory() {
      wx.navigateTo({
        url: '/pages/inventory/inventory',
      });
    },
  
    navigateToBorrowHistory() {
      wx.navigateTo({
        url: '/pages/history/history',
      });
    },
  });